]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
places: Port to GSettings
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 16 Jan 2011 19:18:09 +0000 (20:18 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 17 Jan 2011 14:54:24 +0000 (15:54 +0100)
'Places' follows the nautilus preference of whether the Desktop
should be a separate directory or the home folder should be used.
Nautilus has been ported to GSettings a while ago, so follow suit.

https://bugzilla.gnome.org/show_bug.cgi?id=639689

js/ui/placeDisplay.js

index c31bf965143b5669dad1a404bcfcf423e46e03ad..80f632c48b86c400d1953990851aa839f459b56b 100644 (file)
@@ -1,6 +1,5 @@
 /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
 
-const GConf = imports.gi.GConf;
 const GLib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
 const Shell = imports.gi.Shell;
@@ -16,8 +15,8 @@ const Main = imports.ui.main;
 const Search = imports.ui.search;
 const Util = imports.misc.util;
 
-const NAUTILUS_PREFS_DIR = '/apps/nautilus/preferences';
-const DESKTOP_IS_HOME_KEY = NAUTILUS_PREFS_DIR + '/desktop_is_home_dir';
+const NAUTILUS_PREFS_SCHEMA = 'org.gnome.nautilus.preferences';
+const DESKTOP_IS_HOME_KEY = 'desktop-is-home-dir';
 
 /**
  * Represents a place object, which is most normally a bookmark entry,
@@ -122,13 +121,15 @@ function PlacesManager() {
 
 PlacesManager.prototype = {
     _init: function() {
-        let gconf = GConf.Client.get_default();
-        gconf.add_dir(NAUTILUS_PREFS_DIR, GConf.ClientPreloadType.PRELOAD_NONE);
-
         this._defaultPlaces = [];
         this._mounts = [];
         this._bookmarks = [];
-        this._isDesktopHome = gconf.get_bool(DESKTOP_IS_HOME_KEY);
+
+        this._settings = new Gio.Settings({ schema: NAUTILUS_PREFS_SCHEMA });
+        this._isDesktopHome = this._settings.get_boolean(DESKTOP_IS_HOME_KEY);
+        this._settings.connect('changed::' + DESKTOP_IS_HOME_KEY,
+                               Lang.bind(this,
+                                         this._updateDesktopMenuVisibility));
 
         let homeFile = Gio.file_new_for_path (GLib.get_home_dir());
         let homeUri = homeFile.get_uri();
@@ -228,9 +229,6 @@ PlacesManager.prototype = {
         }));
 
         this._reloadBookmarks();
-
-        gconf.notify_add(DESKTOP_IS_HOME_KEY, Lang.bind(this, this._updateDesktopMenuVisibility));
-
     },
 
     _updateDevices: function() {
@@ -340,8 +338,7 @@ PlacesManager.prototype = {
     },
 
     _updateDesktopMenuVisibility: function() {
-        let gconf = GConf.Client.get_default();
-        this._isDesktopHome = gconf.get_boolean(DESKTOP_IS_HOME_KEY);
+        this._isDesktopHome = this._settings.get_boolean(DESKTOP_IS_HOME_KEY);
 
         if (this._isDesktopHome)
             this._removeById(this._defaultPlaces, 'special:desktop');